august 2010 doc id 17051 rev 1 1/34 an3151 application note digital constant-current controller for led applications ba sed on stm8s208x introduction leds have been used for many years simply as status indicators but are now playing a considerable role in a host of application fields, even with high power requirements, due to improvements in lighting efficien cy, longer lifetime, reliability, and costs. led-based lighting systems are increasingly used in display panels, emergency lighting, architectural lighting and also backlighting. the growth of such systems is mainly d ue to new manufacturing technologies and innovations in this segment area, which probably represent the most important markets within the lighting field. the intent of this application note is to describe a new technique, based on a digital approach, performing a real average current-control on an led streetlighting platform. a demonstration board, based on this approach, is orderable with the steval-ill031v1 code. further details are shown in steval-ill031v1 documentation. the led streetlight platform has been developed on a dc-dc converter based on an ?inverse buck? converter, creating advantages in terms of power switch control and conditioning signal circuitry for the current sensing. moreover, performance, including cost performance, is also looked at. this solution has been customized for a streetlighting application but can be extended to many other fields. the advantages offered are in terms of low energy consumption, low maintenance, and a small and lightweight design. the real aim of this application note is to describe the average current-control methodology suitable for led driving. the effectiveness of the control with the inverse buck's advantages is described on a dimmable platform, based on a multi-string system up to 120 w with independent current control. two different kinds of dimming have been implemented: analog, also called linear dimming, and digital. the control has been implemented on the stm8s208rb microcontroller, [ 1 ] which is the best compromise in terms of cost and performance, validating an innovative current reading methodology. www.st.com
contents an3151 2/34 doc id 17051 rev 1 contents 1 hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1 power stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2 control stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 microcontroller peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.1 timer1: advanced control timer (tim1) . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 ad converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3 overview of inverse buck con verter . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1 average current reading methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4 independent current control for a multi-string system . . . . . . . . . . . . 14 5 firmware implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.1 basic initialization of peripherals and i/o pins . . . . . . . . . . . . . . . . . . . . . 17 5.2 peripheral settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 5.3 pi regulator overview and firmware implem entation . . . . . . . . . . . . . . . . 19 6 board description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 7 experimental results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 8 short-circuit protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 9 bill of material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 10 references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 11 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
an3151 list of figures doc id 17051 rev 1 3/34 list of figures figure 1. principle schematic of the circuit described . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 figure 2. power stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 figure 3. control stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 figure 4. tim1 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 figure 5. tim1 and adc triggering functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 figure 6. inverse buck converter (single-string). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 7. counter(a), pwm(b) and iled(c) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 figure 8. multi string current control methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 9. basic flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 figure 10. current control flowchart. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 11. pi standard controller with anti-saturation control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 12. led street light platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 figure 13. iled on 3 strings (green, blue and violet waveforms); pwm @100 khz (yellow waveform) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 14. iled on 3 strings (green, blue and violet waveforms); voltage across the sense resistor (yellow waveform) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 figure 15. iled on 3 strings (green, violet and blue waveforms) @ 60% of duty cycle (pwm dimming) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 figure 16. iled on string (violet waveform) @ minimum pwm dimming; pwm (yellow waveform) . . 25 figure 17. mosfet turn-on zoom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 18. mosfet turn-off zoom. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 figure 19. overall efficiency (4 channels) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 figure 20. short-circuit protection circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 figure 21. short-circuit event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 figure 22. electro-optical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
hardware an3151 4/34 doc id 17051 rev 1 1 hardware the hardware is mainly composed of the power conversion section and the control stage, based on the microcontroller unit. from a common dc voltage input the 4 strings are driven by 4 inverse dc-dc buck converters. the inverse buck converter offers advantages not only in the driving section and the ground referred circuitry but also in terms of cost. all these aspects are explained in detail in the power stage. the principle schematic of the circuit descri bed in this application note is shown in figure 1 . figure 1. principle schematic of the circuit described ! - v $ ' & |